var sys_district_default = '3700000000山东省';
 // 目前可选样式
var CSS_ARRAY=[
    "luna-silver.css",             //0
    "luna.css",                 //1
    "xtheme-gray",            //2
    "xtheme-gray-extend.css",  //3
    "xtheme-human.css",         //4
    "xtheme-azenis.css" ,       //5
    "xtheme-blueen.css"  //6
    ]

    // 框架选择的样式  CSS_ARRAY中index 从0开始       主界面样式不切换
var CSS_INDEX=1
function ltrim(s) {
	return s.replace(/^\s*/, "")
}
function rtrim(s) {
	return s.replace(/\s*$/, "");
}
function trim(s) {
	return rtrim(ltrim(s));
}
function checkTime(i) {
	if (i < 10) {
		i = "0" + i
	}
	return i
}

function formatMM(m) {
	m = m * 1;
	if (m < 10)
		return '0' + m;
	else
		return m;
}

function checkIdcard(idcard) {
	var Errors = new Array("", "身份证号码位数不对!", "身份证号码出生日期超出范围或含有非法字符!",
			"身份证号码校验错误!", "身份证地区非法!");
	var area = {
		11 : "北京",
		12 : "天津",
		13 : "河北",
		14 : "山西",
		15 : "内蒙古",
		21 : "辽宁",
		22 : "吉林",
		23 : "黑龙江",
		31 : "上海",
		32 : "江苏",
		33 : "浙江",
		34 : "安徽",
		35 : "福建",
		36 : "江西",
		37 : "山东",
		41 : "河南",
		42 : "湖北",
		43 : "湖南",
		44 : "广东",
		45 : "广西",
		46 : "海南",
		50 : "重庆",
		51 : "四川",
		52 : "贵州",
		53 : "云南",
		54 : "西藏",
		61 : "陕西",
		62 : "甘肃",
		63 : "青海",
		64 : "宁夏",
		65 : "新疆",
		71 : "台湾",
		81 : "香港",
		82 : "澳门",
		91 : "国外"
	}
	var idcard, Y, JYM;
	var S, M;
	var idcard_array = new Array();
	idcard_array = idcard.split("");
	// 地区检验
	if (area[parseInt(idcard.substr(0, 2))] == null)
		return Errors[4];
	// 身份号码位数及格式检验
	switch (idcard.length) {
		case 15 :
			if ((parseInt(idcard.substr(6, 2)) + 1900) % 4 == 0
					|| ((parseInt(idcard.substr(6, 2)) + 1900) % 100 == 0 && (parseInt(idcard
							.substr(6, 2)) + 1900)
							% 4 == 0)) {
				ereg = /^[1-9][0-9]{5}[0-9]{2}((01|03|05|07|08|10|12)(0[1-9]|[1-2][0-9]|3[0-1])|(04|06|09|11)(0[1-9]|[1-2][0-9]|30)|02(0[1-9]|[1-2][0-9]))[0-9]{3}$/;// 测试出生日期的合法性
			} else {
				ereg = /^[1-9][0-9]{5}[0-9]{2}((01|03|05|07|08|10|12)(0[1-9]|[1-2][0-9]|3[0-1])|(04|06|09|11)(0[1-9]|[1-2][0-9]|30)|02(0[1-9]|1[0-9]|2[0-8]))[0-9]{3}$/;// 测试出生日期的合法性
			}
			if (ereg.test(idcard))
				return Errors[0];
			else {

				return Errors[2];
			}
			break;
		case 18 :
			// 18位身份号码检测
			// 出生日期的合法性检查
			// 闰年月日:((01|03|05|07|08|10|12)(0[1-9]|[1-2][0-9]|3[0-1])|(04|06|09|11)(0[1-9]|[1-2][0-9]|30)|02(0[1-9]|[1-2][0-9]))
			// 平年月日:((01|03|05|07|08|10|12)(0[1-9]|[1-2][0-9]|3[0-1])|(04|06|09|11)(0[1-9]|[1-2][0-9]|30)|02(0[1-9]|1[0-9]|2[0-8]))
			if (parseInt(idcard.substr(6, 4)) % 4 == 0
					|| (parseInt(idcard.substr(6, 4)) % 100 == 0 && parseInt(idcard
							.substr(6, 4))
							% 4 == 0)) {
				ereg = /^[1-9][0-9]{5}[1-2][0-9][0-9]{2}((01|03|05|07|08|10|12)(0[1-9]|[1-2][0-9]|3[0-1])|(04|06|09|11)(0[1-9]|[1-2][0-9]|30)|02(0[1-9]|[1-2][0-9]))[0-9]{3}[0-9XxTP]$/;// 闰年出生日期的合法性正则表达式
			} else {
				ereg = /^[1-9][0-9]{5}[1-2][0-9][0-9]{2}((01|03|05|07|08|10|12)(0[1-9]|[1-2][0-9]|3[0-1])|(04|06|09|11)(0[1-9]|[1-2][0-9]|30)|02(0[1-9]|1[0-9]|2[0-8]))[0-9]{3}[0-9XxTP]$/;// 平年出生日期的合法性正则表达式
			}

			if (ereg.test(idcard)) {// 测试出生日期的合法性
				/* 计算校验位
				S = (parseInt(idcard_array[0]) + parseInt(idcard_array[10]))
						* 7
						+ (parseInt(idcard_array[1]) + parseInt(idcard_array[11]))
						* 9
						+ (parseInt(idcard_array[2]) + parseInt(idcard_array[12]))
						* 10
						+ (parseInt(idcard_array[3]) + parseInt(idcard_array[13]))
						* 5
						+ (parseInt(idcard_array[4]) + parseInt(idcard_array[14]))
						* 8
						+ (parseInt(idcard_array[5]) + parseInt(idcard_array[15]))
						* 4
						+ (parseInt(idcard_array[6]) + parseInt(idcard_array[16]))
						* 2 + parseInt(idcard_array[7]) * 1
						+ parseInt(idcard_array[8]) * 6
						+ parseInt(idcard_array[9]) * 3;
				Y = S % 11;
				M = "F";
				JYM = "10X98765432";
				M = JYM.substr(Y, 1);// 判断校验位
				if (M == idcard_array[17] || 'P' == idcard_array[17]
						|| 'T' == idcard_array[17])*/
				if(/^[0-9XxTP]{1}$/.test(idcard_array[17]))
					return Errors[0]; // 检测ID的校验位
				else
					return Errors[3];
			} else {
				return Errors[2];
			}
			break;
		default :
			return Errors[1];
			break;
	}
}

// 15位身份证转18位 start
function cardID15to18(cardID) {
	var v = new Array();
	var vs = "10X98765432";
	v.push(2, 4, 8, 5, 10, 9, 7, 3, 6, 1, 2, 4, 8, 5, 10, 9, 7);
	var month = cardID.substring(8, 10);// 获得15位号码中的月份
	var year = "19" + cardID.substring(6, 8);
	var day = cardID.substring(10, 12);
	// 将15位的号码转换位17位
	var cardID17 = cardID.substring(0, 6) + "19" + cardID.substring(6);
	var N = 0;
	var R = -1;
	var T = '0';// 储存最后一个数字
	var j = 0;
	var cardID18 = "";
	for (var i = 16; i >= 0; i--) {
		N += parseInt(cardID17.substring(i, i + 1)) * v[j];
		j++;
	}
	R = N % 11;
	T = vs.charAt(R);
	cardID18 = cardID17 + T;
	return cardID18;
}

// 15位身份证转18位 end

function GetBirthday(idcard) {
	if (idcard.length == 15) {
		return "19" + idcard.substring(6, 8) + idcard.substring(8, 12);
	} else {
		return idcard.substring(6, 10) + idcard.substring(10, 14);
	}
}
function GetSex(idcard) {
	return idcard.slice(14, 17) % 2 ? "1" : "2";
}
/**
 * 日期比较函数 hezn
 * 
 * @param sDate1
 * @param sDate2
 * @return boolean
 */
function compareDate(sDate1, sDate2) {
    
	var d1 = new Date(sDate1.replace(/-/g, "/"));
	var d2 = new Date(sDate2.replace(/-/g, "/"));
	if (d1.getTime() > d2.getTime()) {
		return true;
	} else {
		return false;
	}
}
function checkId(pId) {
	// 检查身份证号码
	var arrVerifyCode = [1, 0, "x", 9, 8, 7, 6, 5, 4, 3, 2];
	var Wi = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2];
	var Checker = [1, 9, 8, 7, 6, 5, 4, 3, 2, 1, 1];

	if (pId.length != 15 && pId.length != 18)
		return "身份证号共有 15 码或18位";

	var Ai = pId.length == 18 ? pId.substring(0, 17) : pId.slice(0, 6) + "19"
			+ pId.slice(6, 16);

	if (!/^\d+$/.test(Ai))
		return "身份证除最后一位外，必须为数字！";

	var yyyy = Ai.slice(6, 10), mm = Ai.slice(10, 12) - 1, dd = Ai
			.slice(12, 14);

	var d = new Date(yyyy, mm, dd), now = new Date();
	var year = d.getFullYear(), mon = d.getMonth(), day = d.getDate();

	if (year != yyyy || mon != mm || day != dd || d > now || year < 1940)
		return "身份证输入错误！";

	for (var i = 0, ret = 0; i < 17; i++)
		ret += Ai.charAt(i) * Wi[i];
	Ai += arrVerifyCode[ret %= 11];

	return pId.length == 18 && pId != Ai ? "身份证输入错误！" : Ai;
};

function getInfo(id) {
	var arr = [null, null, null, null, null, null, null, null, null, null,
			null, "北京", "天津", "河北", "山西", "内蒙古", null, null, null, null, null,
			"辽宁", "吉林", "黑龙江", null, null, null, null, null, null, null, "上海",
			"江苏", "浙江", "安微", "福建", "江西", "山东", null, null, null, "河南", "湖北",
			"湖南", "广东", "广西", "海南", null, null, null, "重庆", "四川", "贵州", "云南",
			"西藏", null, null, null, null, null, null, "陕西", "甘肃", "青海", "宁夏",
			"XJ", null, null, null, null, null, "台湾", null, null, null, null,
			null, null, null, null, null, "香港", "澳门", null, null, null, null,
			null, null, null, null, "国外"]
	// id=checkId(id)
	var err = checkIdcard(id)
	// if (isNaN(id)) return "错误的身份证号码"
	if (err != '') {
		alert(err);
		return ['', '', '']
	}
	var id = String(id), prov = arr[id.slice(0, 2)]
	var sex;
	if (id.length == 15)
		sex = id.slice(14, 15) % 2 ? "1" : "2";
	else
		sex = id.slice(16, 17) % 2 ? "1" : "2";
	// sex=id.slice(14,17)%2? "1" : "2"
	var birthday;
	if (id.length == 18)
		birthday = (new Date(id.slice(6, 10), id.slice(10, 12) - 1, id.slice(
						12, 14)))
	else
		birthday = (new Date(('19' + id.slice(6, 8)), id.slice(8, 10) - 1, id
						.slice(10, 12)))
	return [prov, birthday, sex]
}
// 15位身份证转18位 start
function cardID15to18(cardID) {
	var v = new Array();
	var vs = "10X98765432";
	v.push(2, 4, 8, 5, 10, 9, 7, 3, 6, 1, 2, 4, 8, 5, 10, 9, 7);
	var month = cardID.substring(8, 10);// 获得15位号码中的月份
	var year = "19" + cardID.substring(6, 8);
	var day = cardID.substring(10, 12);
	// 将15位的号码转换位17位
	var cardID17 = cardID.substring(0, 6) + "19" + cardID.substring(6);
	var N = 0;
	var R = -1;
	var T = '0';// 储存最后一个数字
	var j = 0;
	var cardID18 = "";
	for (var i = 16; i >= 0; i--) {
		N += parseInt(cardID17.substring(i, i + 1)) * v[j];
		j++;
	}
	R = N % 11;
	T = vs.charAt(R);
	cardID18 = cardID17 + T;
	return cardID18;
}

// 15位身份证转18位 end

function checkFileSize(filename) {
	try {		
		var stream = new ActiveXObject("ADODB.Stream");		
		stream.Type = 1;
		stream.Open();
		stream.LoadFromFile(filename);

		if (stream.Size > 51200) {
			return 1;
		}
	} catch (e) {

//		alert(e + "\n 浏览器安全性太高,\n" + "1 将本站点加入安全站点\n" + "2 在浏览器菜单栏上依次选择\n"
//				+ "工具->internet选项->\"安全\"选择可信站点\"选项卡->自定义级别,\n"
//				+ "打开\"安全设置\"对话框，把\"对没有标记为安全的\n"
//				+ "ActiveX控件进行初始化和脚本运行\"，改为\"启用\"\n"
//				+ "并且,把\"通过域访问数据资源\，改为\"启用\"，即可");
				
		alert(e + "\n"
				+ "您的浏览器安全性太高\n" 
				+ "您现在需要，依次选择：工具->internet选项->安全，然后执行：\n"
				+ "1.将本站点加入受信任的站点\n" 
				+ "2.选择“受信任的站点”，在“自定义级别”中\n"
				+ "  把“对没有标记为安全的ActiveX控件进行初始化和脚本运行”，改为“启用”\n"
				+ "  把“通过域访问数据资源”，改为“启用”，即可");
		return -1;
	}
	return 0;
}


function checkEmergencyFileSize(filename,size) {
    if(size==undefined||size==0)size=5120000;


	try {
		var stream = new ActiveXObject("ADODB.Stream");
		stream.Type = 1;
		stream.Open();
		stream.LoadFromFile(filename);

		if (stream.Size > size) {
			return 1;
		}
	} catch (e) {

//		alert(e + "\n 浏览器安全性太高,\n" + "1 将本站点加入安全站点\n" + "2 在浏览器菜单栏上依次选择\n"
//				+ "工具->internet选项->\"安全\"选择可信站点\"选项卡->自定义级别,\n"
//				+ "打开\"安全设置\"对话框，把\"对没有标记为安全的\n"
//				+ "ActiveX控件进行初始化和脚本运行\"，改为\"启用\"\n"
//				+ "并且,把\"通过域访问数据资源\，改为\"启用\"，即可");

		alert(e + "\n"
				+ "您的浏览器安全性太高\n"
				+ "您现在需要，依次选择：工具->internet选项->安全，然后执行：\n"
				+ "1.将本站点加入受信任的站点\n"
				+ "2.选择“受信任的站点”，在“自定义级别”中\n"
				+ "  把“对没有标记为安全的ActiveX控件进行初始化和脚本运行”，改为“启用”\n"
				+ "  把“通过域访问数据资源”，改为“启用”，即可");
		return -1;
	}
	return 0;
}

// 获取grid 高度
function getGridHeight(screenheight, alterHeight, tabNum) {
	return screenheight - alterHeight - tabNum * 10;

}




// 屏蔽 backspace
if (typeof window.event != 'undefined') {
	document.onkeydown = function() {
        var obj = event.target || event.srcElement;//获取事件源

		var type = event.srcElement.type;
		var code = event.keyCode;

		return ((code != 8 && code != 13) || (type == 'text' && code != 13&& !(code=8 && event.srcElement.readOnly))
				|| (type == 'password' && code != 13) || (type == 'textarea'&& !(code=8 && event.srcElement.readOnly)) || (type == 'submit' && code == 13)) 
      /*  var flag1=(ev.keyCode == 8 && (t=="password" || t=="text" || t=="textarea") && (vReadOnly==true || vEnabled!=true))?true:false;

                  //当敲Backspace键时，事件源类型非密码或单行、多行文本的，则退格键失效
                  var flag2=(ev.keyCode == 8 && t != "password" && t != "text" && t != "textarea")?true:false;

                  //判断
                  if(flag2){
                      return false;
                  }
                  if(flag1){
                      return false;
                  }
        */
	}
} else { // FireFox/Others

	document.onkeypress = function(e) {
		var type = e.target.type;
		var code = e.keyCode;
		if ((code != 8 && code != 13) || (type == 'text' && code != 13)
				|| (type == 'password' && code != 13) || (type == 'textarea')
				|| (type == 'submit' && code == 13)) {
			return true
		} else {
			// alert('你真的想放弃现在正在编辑的内容吗？再想想！');
			return false
		}
	}

//	function checkFileSize(filename) {
//		try {
//			var stream = new ActiveXObject("ADODB.Stream");
//			stream.Type = 1;
//			stream.Open();
//			stream.LoadFromFile(filename);
//			if (stream.Size > 1024000) {
//				return 1;
//			}
//		} catch (e) {
//			return -1;
//		}
//		return 0;
//	}
}



try{
	Ext.override(Ext.form.ComboBox, {
			onViewClick : function(doFocus) {
				var index = this.view.getSelectedIndexes()[0], s = this.store, r = s
						.getAt(index);
				if (r) {
					this.onSelect(r, index);
				} else if (s.getCount() === 0) {
					this.collapse();
				}
				if (doFocus !== false) {
					this.el.focus();
				}
			}
		});
	Ext.Ajax.timeout = 900000
}catch(e){}


// 更换样式  hezn 2012
function addCssByLink(){

   var css_cur= CSS_ARRAY[CSS_INDEX];
    if(css_cur==undefined||css_cur=='') css_cur="luna-silver.css"
   var doc=document;

    var heads = doc.getElementsByTagName("head");
    var links = doc.getElementsByTagName("link");
    var url=''
    if(links.length>0){
        for(var i=0;i<links.length;i++){
            if(links[0].href.indexOf('ext-all.css',0)>0) {
                url=links[0].href;
                url=url.substring(0,links[0].href.indexOf('ext-all.css',0))+css_cur;
                //url.replace('ext-all.css','ext-patch.css')
                break;
            }

        }
    }

    if(url.length>0)  {

        var link=doc.createElement("link");

        link.setAttribute("rel", "stylesheet");

        link.setAttribute("type", "text/css");

        link.setAttribute("href", url);

        if(heads.length)

            heads[0].appendChild(link);

        else
            doc.documentElement.appendChild(link);
    }


}
addCssByLink();


/* public
 * 
 * */

/**
 * init combobox
 */
function initSelect(selectId, jsondata, selectValue, extraFun) {

	var selectDom = $("#" + selectId);
	selectDom.empty();
	var json;
	try {
		json = eval('(' + jsondata + ')');
	} catch (e) {
		json = jsondata;
	}
	selectDom.append("<option value=''>--请选择--</option>");
	for (var i = 0; i < json.length; i++) {
		var val = json[i]['code'] + "";
		var text = json[i]['name'] + "";
		if (val == selectValue)
			selectDom.append("<option value=" + val + " selected='selected''>"
					+ text + "</option>");
		else
			selectDom.append("<option value=" + val + ">" + text + "</option>");
	}
	extraFun();
}

/**
 * 动态给span加载元素
 * 
 * @param {}
 *            panelId 目标id
 * @param {}
 *            json json数据格式数据 string
 * @param {}
 *            count 每行显示数 int
 * @param {}
 *            type 1:checkbox 2:radio
 * @param {}
 *            elementName 元素名
 * @param {}
 *            align 显示位置
 */
function fillPanel(panelId, jsondata, count, type, elementName, defaultValue,
		align) {
	var json;
	try {
		json = eval('(' + jsondata + ')');
	} catch (e) {
		json = jsondata;
	}
	var index = 1;
	var str = "<table width='100%' style='border:0px;' cellpadding='0' cellspacing='0'><tr>";
	$("#" + panelId).empty();
	for (var key in json) {
		var code = key;
		var name = json[key] + "";
		if (type == "1") {
			str += "<td style='border:0px;text-align:" + align
					+ "'><label><input type='checkbox' name='" + elementName
					+ "' value='" + code + "'";
			if (("," + defaultValue.replace(/(\s*)/g, "") + ",").indexOf(","
					+ code.replace(/(\s*)/g, "") + ",") != -1)
				str += "checked='checked'";
			str += "/> " + name + "<label></td>";
		} else {
			str += "<td style='border:0px;text-align:" + align
					+ "'><label><input type='radio' name='" + elementName
					+ "' value='" + code + "'";
			if (defaultValue == code)
				str += "checked='checked'";
			str += "/> " + name + "</label></td>";
		}
		if (index == count) {
			str += "</tr><tr>";
			index = 0;
		}
		index++;
	}
	str += "</table>";
	$("#" + panelId).html(str);
}


function fillPanel_auto(panelId, jsondata, count, type, elementName, defaultValue,
		align) {
	var json;
	try {
		json = eval('(' + jsondata + ')');
	} catch (e) {
		json = jsondata;
	}
	var index = 1;
	var str = "<table width='100%' ><tr>";
	$("#" + panelId).empty();
	for (var i = 0; i < json.length; i++) {
		var code = json[i]['code'] + "";
		var name = json[i]['name'] + "";

		if (type == "1") {
			str += "<td style='text-align:" + align
					+ ";border:0px;'><label><input type='checkbox' name='" + elementName
					+ "' value='" + code + "'";
			if (("," + defaultValue.replace(/(\s*)/g, "") + ",").indexOf(","
					+ code.replace(/(\s*)/g, "") + ",") != -1)
				str += "checked='checked'";
			str += " text='" + name + "'/> " + name + "<label></td>";
		} else {
			str += "<td style='text-align:" + align
					+ ";border:0px;'><label><input type='radio' name='" + elementName
					+ "' value='" + code + "'";
			if (defaultValue == code)
				str += "checked='checked'";
			str += " text='" + name + "'/> " + name + "</label></td>";
		}
		if (index == count) {
			str += "</tr><tr>";
			index = 0;
		}
		index++;
	}
	str += "</table>";
	$("#" + panelId).html(str);
}

//init data by input field id from json object.
function initData2Field(jsonStr) {
	jsonStr = nowMessage[parseInt(jsonStr,10)];
	var code = '',hjcode='',xzcode='';
	var name = '',hjname='',xzname='';
	if (null != jsonStr && "" != jsonStr) {
		var json;
		try {
			json = eval('(' + jsonStr + ')');
		} catch (e) {
			json = jsonStr;
		}
		for (var key in json) {
			try {
				var value = json[key];
				if('' == code)
					if(key == "gbcode"){
						code = value;
					}
				if('' == name)
					if(key == "gbname"){
						name = value;
					}
				if('' == hjcode)
					if(key == "houseAddrCode"){
						hjcode = value;
					}
				if('' == hjname)
					if(key == "houseAddrName"){
						hjname = value;
					}
				if('' == xzcode)
					if(key == "currentAddrCode"){
						xzcode = value;
					}
				if('' == xzname)
					if(key == "currentAddrName"){
						xzname = value;
					}
				if (value == 'null')
					continue;
				if ($("#" + key).length == 0) {
					value = value.replace(/(\s*)/g, "");
					buildRadioList(key, value);
					buildCheckboxList(key, value);
				} else{
					if ($("#" + key).attr("type") == "checkbox") {
						buildCheckboxList(key, value);
					} else
						$("#" + key).val(value);
				}
			} catch (e) {
				continue;
			}
		}
	}
	try{
		comboxWithTree.setRawValue(code+name);
		comboxWithTreeHj.setRawValue(hjcode+hjname);
		comboxWithTreeHj_op.setRawValue(hjcode+hjname);
		comboxWithTreeXz.setRawValue(xzcode+xzname);
		comboxWithTreeXz_op.setRawValue(xzcode+xzname);
	}catch(e){}
}

function buildRadioList(name, value) {
	var chkother = document.getElementsByTagName("input");
	for (var i = 0; i < chkother.length; i++) {
		if (chkother[i].type == 'radio') {
			if (chkother[i].name.indexOf("." + name) > -1) {
				if (chkother[i].value == value) {
					chkother[i].checked = true;
				}
			}
		}
	}
}

function buildCheckboxList(name, value) {
	var chkother = document.getElementsByTagName("input");
	for (var i = 0; i < chkother.length; i++) {
		if (chkother[i].type == 'checkbox') {
			if (chkother[i].name.indexOf("." + name) > -1) {
				if (("," + value + ",").indexOf(","
						+ chkother[i].value.replace(/(\s*)/g, "") + ",") != -1) {
					chkother[i].checked = true;
				}
			}
		}
	}
}

function GetPageScroll() {
	var x, y;
	if (window.pageYOffset) { // all except IE
		y = window.pageYOffset;
		x = window.pageXOffset;
	} else if (document.documentElement && document.documentElement.scrollTop) { // IE 6
		// Strict
		y = document.documentElement.scrollTop;
		x = document.documentElement.scrollLeft;
	} else if (document.body) { // all other IE
		y = document.body.scrollTop;
		x = document.body.scrollLeft;
	}
	return y;
}

/**
 * 通用解析单选按钮
 *  value:		值
 *  objStore:	目标store
 */
function format_objStore(value, objStore) {
	var bv = '';
	for (var i = 0; i < objStore.getCount(); i++) {
		if (objStore.getAt(i).data['value'] == value) {
			bv = objStore.getAt(i).data['label'];
			break;
		}
	}
	return bv;
}

   function closeDH(){
     Ext.getCmp("centerTabPanelPro").remove(2);
    }
    function closeTabPage(){       
        Ext.getCmp("centerTabPanelPro").remove(2);
        Ext.getCmp("grid").getStore().reload();
     }
    function showInfo(txt) {
    Ext.MessageBox.show({
        title : '系统提示',
        msg : '<span style="text-align:center;width:250px;margin:5 0 5 0;word-wrap:normal;">'
                + txt
                + '</span>',
        buttons : Ext.MessageBox.OK,
        width:350,
        icon : Ext.MessageBox.INFO
    });
}

	  function validTextareaLength(alertText){
	  	var textareaTag = document.getElementsByTagName("textarea");
	  	for(var i=0;i<textareaTag.length;i++){
	  		if(textareaTag[i].style.border=='red double'){
				alert(alertText);
				textareaTag[i].focus();
				return false;
	  		}
	  	}
	  	return true;
	  }
	  
	  
	  function checkName(value)//验证只能是中文
	{    
       var s=/^[\u4e00-\u9fa5]+$/; 
       if(value.search(s)==-1)
       {
           return false;
       }       
       return true;
	}
	
	function onlyNum() {
    if (!((event.keyCode >= 48 && event.keyCode <= 57 )|| event.keyCode == 190||event.keyCode == 110|| (event.keyCode >= 96 && event.keyCode <= 105)))
    //考虑小键盘上的数字键
        if (event.keyCode != 8&&event.keyCode != 13)event.returnValue = false;
    //  return false;
}